-
Notifications
You must be signed in to change notification settings - Fork 38.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move api helpers.go to a subpackage #44296
Move api helpers.go to a subpackage #44296
Conversation
ce168bd
to
9c5e7a4
Compare
bfe0965
to
2708d2a
Compare
2708d2a
to
70f0ba4
Compare
@k8s-bot unit test this |
func LoadBalancerStatusDeepCopy(lb *LoadBalancerStatus) *LoadBalancerStatus { | ||
c := &LoadBalancerStatus{} | ||
c.Ingress = make([]LoadBalancerIngress, len(lb.Ingress)) | ||
func LoadBalancerStatusDeepCopy(lb *api.LoadBalancerStatus) *api.LoadBalancerStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function seems bad, are there users of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, a few invocations in pkg/controller/service and pkg/proxy.
pkg/api/helper/helpers.go
Outdated
c.Message, reflect.TypeOf(c.In), c.In, reflect.TypeOf(c.Out), | ||
) | ||
} | ||
|
||
const ( | ||
// annotation key prefix used to identify non-convertible json paths. | ||
NonConvertibleAnnotationPrefix = "non-convertible.kubernetes.io" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this stay in the api package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you address this one, I'll lgtm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -301,7 +302,7 @@ func Convert_extensions_ReplicaSet_to_v1_ReplicationController(in *extensions.Re | |||
if out.Annotations == nil { | |||
out.Annotations = make(map[string]string) | |||
} | |||
out.Annotations[api.NonConvertibleAnnotationPrefix+"/"+fieldErr.Field] = reflect.ValueOf(fieldErr.BadValue).String() | |||
out.Annotations[helper.NonConvertibleAnnotationPrefix+"/"+fieldErr.Field] = reflect.ValueOf(fieldErr.BadValue).String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to fix in this PR, but we should probably provide a function instead of making everyone do this concatenation.
I have slightly mixed feelings, but overall I think this is a good step. |
70f0ba4
to
08aa712
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: caesarxuchao, lavalamp
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue |
Automatic merge from submit-queue (batch tested with PRs 44406, 41543, 44071, 44374, 44299) Move pkg/api/ref.go to a subpackage First commit is #44296. (unfortunately, removing that commit results in conflicts) This PR moves the pkg/api/ref.go to its own subpackage. It's mostly a mechanic move. I'll send a few more PRs to make the k8s.io/kubernetes/pkg/api package only contains the code we want in the k8s.io/api repo, then we can run a [script](a0015fd#diff-7a2fbb4371972350ee414c6b88aee1c8) to cut the new repo.
Automatic merge from submit-queue (batch tested with PRs 44440, 44038, 44302, 44316, 43876) Move pkg/api/ref.go and pkg/api/resource_helpers.go to subpackages First two commits are #44296 #44299. (unfortunately, removing these commits results in conflicts) This PR moves resource_helpers.go to a subpackage. It's mostly a mechanic move, except that: * i kept the methods of ResourceName and ResourceList in pkg/api/method.go I'll send one more PR to separate api.Scheme etc. to their own package.
Automatic merge from submit-queue (batch tested with PRs 44364, 44361, 42498) Move v1 helpers The first 3 commits are other PRs. This PR move pkg/api/v1/helpers.go to a subpackage, which is almost symmetric to #44296, where pkg/api/helpers.go was moved. This PR is mostly mechanic, except that 1. moved the 3 methods of Taint and Toleration to pkg/api/methods.go 2. moved constants and types defined in v1/helpers.go to pkg/api/v1/annotataion_key_constants.go and nonstandard_types.go 3. updated staging/copy.sh to copy pkg/api/helpers to client-go, it's otherwise removed from client-go because no other code in client-go depends on the package. Some test code in pkg/controller imports client-go/pkg/api/helpers. After moving api types to its own repo, we can remove these copies of utility function from client-go and ask users to use the ones in the main repo. (This PR breaks a cyclic import problem i met when I tried to move global variables pkg/api/Scheme and Registry to a subpackage)
Automatic merge from submit-queue (batch tested with PRs 44364, 44361, 42498) Move v1 helpers The first 3 commits are other PRs. This PR move pkg/api/v1/helpers.go to a subpackage, which is almost symmetric to kubernetes#44296, where pkg/api/helpers.go was moved. This PR is mostly mechanic, except that 1. moved the 3 methods of Taint and Toleration to pkg/api/methods.go 2. moved constants and types defined in v1/helpers.go to pkg/api/v1/annotataion_key_constants.go and nonstandard_types.go 3. updated staging/copy.sh to copy pkg/api/helpers to client-go, it's otherwise removed from client-go because no other code in client-go depends on the package. Some test code in pkg/controller imports client-go/pkg/api/helpers. After moving api types to its own repo, we can remove these copies of utility function from client-go and ask users to use the ones in the main repo. (This PR breaks a cyclic import problem i met when I tried to move global variables pkg/api/Scheme and Registry to a subpackage)
Part of #44065.
This PR moves the pkg/api/helpers.go to its own subpackage. It's mostly a mechanic move, except that
I'll send a few more PRs to make the k8s.io/kubernetes/pkg/api package only contains the code we want in the k8s.io/api repo, then we can run a script to cut the new repo.